package rs.ac.uns.ftn.informatika.mbs2.e11031.etaksi.servlet;

import java.io.IOException;

import javax.ejb.EJB;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import rs.ac.uns.ftn.informatika.mbs2.e11031.etaksi.dao.VozacDao;
import rs.ac.uns.ftn.informatika.mbs2.e11031.etaksi.entitet.Vozac;

@SuppressWarnings("serial")
public class ObrisiVozacaKontroler extends HttpServlet {

	@EJB
	private VozacDao cVozacDao;

	@Override
	protected void doGet(HttpServletRequest req, HttpServletResponse resp)
			throws ServletException, IOException {

		int id = Integer.parseInt(req.getParameter("id"));
		Vozac vozac = cVozacDao.pronadjiPoId(id);
		cVozacDao.ukloni(vozac);

		getServletContext().getRequestDispatcher("/PrikazVozacKontroler")
				.forward(req, resp);
	}

	@Override
	protected void doPost(HttpServletRequest req, HttpServletResponse resp)
			throws ServletException, IOException {
	}
}
